<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:ds="http://deltaset.org/deltaset-faces"
                xmlns:mf="http://java.sun.com/jsf/composite/deltaset.meta/flow"
                xmlns:composite="http://java.sun.com/jsf/composite"> 
    <ds:pagedDataTable
        pageHelper="#{meta.all(param.page)}"
        showPager="both"
        pageParamName="page">			 
        <c:forEach items="#{meta.listFields}" var="field">
            <h:column>			 
                <f:facet name="header">
                    <h:outputText value="#{meta.labelField(field, meta.modelClass)}"/>
                </f:facet>
                <mf:output-list meta="#{meta}"
                                field="#{field}" 
                                value="#{item[field.propertyName]}"/>
            </h:column>
        </c:forEach>
        <h:column>
            <f:facet name="header">
                <h:outputText value="id"/>
            </f:facet>
            <h:outputText value="#{meta.getItemId(item)}"/>                
        </h:column>
        <h:column>
            <f:facet name="header">
                <h:outputText value="Actions"/>
            </f:facet>
            <h:panelGroup rendered="#{not meta.isNew(item)}">
                <c:set var="recordId" value="#{meta.getItemId(item)}"/>
                <c:set var="itemClassName" value="#{meta.getItemClassName(item)}"/>
                <h:commandLink  value="View">
                    <f:ajax event="click" render="@form"/>
                    <f:param name="deltaset.meta.entityClassName" value="#{itemClassName}"/>
                    <f:param name="deltaset.meta.viewName" value="detailTemplate"/>
                    <f:param name="deltaset.meta.recordId" value="#{recordId}"/>
                </h:commandLink>
                <c:forEach items="#{meta.contextActions}" var="action">
                    <mf:commandButton metaAction="#{action}"
                                      model="#{item}"
                                      meta="#{meta}"
                                      useItemParams="true"
                                      itemId="#{recordId}"
                                      itemClassName="#{itemClassName}"
                                      />                   
                </c:forEach>              
            </h:panelGroup>                
        </h:column>			
    </ds:pagedDataTable>    

</ui:composition>
